% ConstantDefinition.m

function ConstantDefinition()
    % 杆长，r0位置
    l0 = 180;
    theta0 = 0;
    l1 = 100;
    l2 = 110;
    l3 = 110;
    l4 = 100;

    MOTION1_OFFSET = pi * 3 / 4;
    MOTION2_OFFSET = - pi / 4;

    Lx = 100;
    Ly = 100;
    LINE_LEN = 50;
    R = 45;
    rM = [90,90];

    FrameRate = 30;
    speed = 50;

    DXL_ID = [1, 2];            % 1 for left(theta1), 2 for right(theta4)
    BAUDRATE = 57600;           % 波特率
    DEVICENAME = 'COM8';        % Check which port is being used on your controller
                                % ex) Windows: 'COM1'   Linux: '/dev/ttyUSB0' Mac: '/dev/tty.usbserial-*'
    ESC_CHARACTER = 'e';        % Key for escaping loop

    save("ConstantDefinition.mat", "l0", "theta0", "l1", "l2", "l3", "l4", "Lx", "Ly" ,...
        "rM", "LINE_LEN", "R", "MOTION1_OFFSET", "MOTION2_OFFSET", "FrameRate", "speed",...
        "DXL_ID", "BAUDRATE", "DEVICENAME", "ESC_CHARACTER");
end